// 投诉相关API
import { request } from '@/utils/request.js'

/**
 * 获取投诉详情
 */
export function getComplaintDetail(id) {
	return request({
		url: '/complaint-server/complaint/detail',
		method: 'GET',
		params: { id }
	})
}

/**
 * 处理投诉（接受/拒绝）
 */
export function processComplaint(id, data) {
	return request({
		url: '/complaint-server/complaint/process',
		method: 'POST',
		data: {
			id,
			...data
		}
	})
}

/**
 * 获取投诉处理记录
 */
export function getComplaintProcessRecords(complaintId) {
	return request({
		url: '/complaint-server/complaint/processRecords',
		method: 'GET',
		params: { complaintId }
	})
}

/**
 * 投诉审批通过（使用Flowable接口）
 */
export function approveComplaint(taskId) {
	return request({
		url: '/flowable-server/workflow/acceptFlow',
		method: 'POST',
		params: { taskId }
	})
}

/**
 * 投诉审批驳回（使用Flowable接口）
 */
export function rejectComplaint(taskId, reason) {
	return request({
		url: '/flowable-server/workflow/rejectFlow',
		method: 'POST',
		params: { taskId, reason }
	})
}
